<?php //strip
/**
 * Implementation of the model for a catalog items.
 * 
 * @package odCatalogWpPlugin
 * @subpackage odCatalogWpPlugin_Models
 * @author Ondrej Donek <ondrejd@gmail.com>
 */
class odCatalogWpPlugin_Models_Item extends odWpPlugin_Model_Simple
{
	public function __construct()
	{
		global $wpdb;
		
		$this->mTableName = $wpdb->prefix . 'catalog_items';
		$this->mPrimary = 'ID';
		$this->mCheckColumn = 'title';
		/*
		$this->mRelations = array(
			'address' => array(
				'type' => 'one-to-one',
				'key' => 'address_ID',
				'target' => 'odCatalogWpPlugin_Models_Item_Address', 
				'target_key' => 'ID'
			)
		);*/
		$this->mColumns = array(
			'ID' => array('type' => 'int', 'primary' => true),
			'urlid' => array('type' => 'char', 'length' => 75),
			'title' => array('type' => 'char', 'length' => 75),
			'advised' => array('type' => 'tinyint', 'length' => 1),
			'logo' => array('type' => 'char', 'length' => 255, 'comment' => 'Path to the image used as logo.'),
			'description' => array('type' => 'text'),
			'card1_discount' => array('type' => 'tinyint', 'length' => 3, 'comment' => 'Percentage of discount for Platinum card'),
			'card2_discount' => array('type' => 'tinyint', 'length' => 3, 'comment' => 'Percentage of discount for Gold card'),
			'card3_discount' => array('type' => 'tinyint', 'length' => 3, 'comment' => 'Percentage of discount for Normal card'),
			'prices' => array('type' => "enum('0','1','2','3','4')", 'comment' => 'Price levels 1-5' ),
			'open_hours' => array('type' => 'char', 'length' => 255),
			'cooking_after_23' => array('type' => 'tinyint', 'length' => 1),
			'lang_spoken' => array('type' => 'char', 'length' => 255),
			'transport' => array('type' => 'char', 'length' => 255),
			'delivery' => array('type' => 'tinyint', 'length' => 1),
			'wifi' => array('type' => 'tinyint', 'length' => 1),
			'credit_cards' => array('type' => 'tinyint', 'length' => 1),
			'email1' => array('type' => 'char', 'length' => 125),
			'email2' => array('type' => 'char', 'length' => 125),
			'website' => array('type' => 'char', 'length' => 255),
			'contact_title' => array('type' => 'char', 'length' => 75),
			'contact_firstname' => array('type' => 'char', 'length' => 75),
			'contact_middlename' => array('type' => 'char', 'length' => 75),
			'contact_surname' => array('type' => 'char', 'length' => 75),
			'contact_address_ID' => array('type' => 'int', 'primary' => true),
			'photogallery_ID' => array('type' => 'int'),
			'adminfield_publish' => array('type' => 'tinyint', 'length' => 1),
			'adminfield_featured' => array('type' => 'tinyint', 'length' => 1),
			'adminfield_access' => array('type' => "enum('public','registered','special')", 'notnull' => true, 'default' => 'public'),
			'adminfield_author' => array('type' => 'int'),
			'adminfield_locale' => array('type' => 'char', 'length' => 5, 'notnull' => true, 'default' => 'en', 'comment' => 'Locales of the item.'),
			'adminfield_starton' => array('type' => 'datetime'),
			'adminfield_endon' => array('type' => 'datetime'),
			'meta_description' => array('type' => 'char', 'length' => 255),
			'meta_keywords' => array('type' => 'char', 'length' => 255)
		);
	}
}  // End of odCatalogWpPlugin_Models_Item
